<template>
  <div class="myContainer">
    <!-- 头部标题 start -->  
    <el-row class="myHeadeTitle">
      <el-col :span="18" class="myLineHeight_35px">
        {{title}}
      </el-col>
    </el-row>
    <!-- 头部标题 end -->
    
    <!-- 数据列表 start -->
    <div class="myPaddingTop_10px">
      <template>
        <el-table
          :data="tableDataList"
          border
          stripe
          @selection-change="handleSelectionChange"
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            width="100">
          </el-table-column>
          <el-table-column
            prop="commit_time"
            label="完成时间">
          </el-table-column>
          <el-table-column
            prop="targetname_list"
            label=巡检对象>
          </el-table-column>
          <el-table-column
            prop="commit_username"
            label="执行人">
          </el-table-column>
          <el-table-column
            prop="phone"
            width="150"
            label="联系电话">
          </el-table-column>
          <el-table-column
            width="100"
            label="巡检结论">
            <template scope="scope">
              {{scope.row.result | onResult}}
            </template>
          </el-table-column>
          <el-table-column
            width="100"
            label="操作">
            <template scope="scope">
              <el-button class="look" type="text" size="small" @click="onGetDetail(scope.row.id)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- 数据列表 end -->
    <!-- 分页控件 start -->
    <div class="block">                    
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page_num"
        :page-sizes="[10, 15]"
        :page-size="page_size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <!-- 分页控件 end -->
  </div>
</template>  

<style scoped>
  .myContainer{
    background: #fff;
    padding: 10px;
  }
  .myHeadeTitle{
    color: #000;
    font-weight: 500;
    font-size: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dbdbdb;
    margin-bottom:10px; 
  }
  .myHeadeTitle:before,.myHeadeTitle:after{
    content: " ";
    display: block;
    clear: both;
  }
  .myBgGreen{
    background: #00c2a9;
    border-color: #00c2a9;
    color: #fff;
    margin-top: 2px;
  }
  .myLineHeight_35px{
    line-height: 35px;
  }
  .myTextAlignRight{
    text-align: right;
  }
  .myBgGreen:hover{
    background: #33ceba;
  }
  .myPaddingTop_10px{
    padding-top: 10px;
  }
</style>

<script>
  import { getInsepectionTaskListByPlanId } from '@/api/routinginspectionplan';
  export default {
     data(){
      return{
        title:"日常巡检情况",
        tableDataList:[],//数据列表
        page_size:10,
        page_num:1,
        total:null,
        regionOptions: [],
        regionOptSelected: [],
        kw:"",
        startTime:"",
        endTime:"",
        date:""
      }
    },
    components: {
       
    },
    filters:{
      onResult(val){
        let type={
          "0":"正常",
          "1":"异常"
        }
        return type[val];
      }
    },
    mounted(){
      document.title = this.title;
      this.id = this.$route.query.id;
      this.date = this.$route.query.date;
      this.onGetInsepectionTaskListByPlanId();
    },
    methods:{
      handleSelectionChange(val) {
        
      },
      handleSizeChange(val) {//每页条数控制
        this.page_size = val;
      },
      handleCurrentChange(val) {//每页
        this.page_num = val;
      },
      onSearchKW:function(){//关键词搜索
        
      },
      onDelete(){//删除

      },
      onGetDetail(task_id){
        this.$router.push({
          path:'/inspectionTaskCountComponentsDetail',
          query: {id: task_id}
        })
      },
      onGetInsepectionTaskListByPlanId(){
        let vm=this;
        let parmes={
          date:vm.date
        }
        getInsepectionTaskListByPlanId(vm.id,parmes).then(response => {
          let res=response.data;
          vm.tableDataList=res.rows;
          console.log("yes",res);
        }).catch(error => {
          console.log("no",error);
        })
      }

    }
  }

</script>  



